let chartDataStr=decodeHtml(charData);
let chartJsonArray=JSON.parse(chartDataStr);

let arrayLength=chartJsonArray.length;
let numericData=[];
let labelData=[];

for (let i=0;i<arrayLength;i++){
    numericData[i]=chartJsonArray[i].value;
    labelData[i]=chartJsonArray[i].value;
}


//饼图
const data = {
    label: labelData,
    datasets: [{
        label: 'My First Dataset',
        data:numericData,
        backgroundColor: [
            'rgb(255, 99, 132)',
            'rgb(54, 162, 235)',
            'rgb(255, 205, 86)'
        ],
        hoverOffset: 4
    }]
};

//配置选项
const options={
    plugins:{
        title:{
            display:true,
            text:"项目状态"
        }
    }
}
new Chart(document.getElementById("myPieChart"),{
        type:'pie',
        data:data,
        options:options,

})
//[{"未开始",1} {"进行中",2} {"已完成",1} ]
function decodeHtml(html){
    let txt=document.createElement("textarea");
    txt.innerHTML=html;
    return txt.value;
}